#include<bits/stdc++.h>
using namespace std;
struct node{
    int cnt;
    int zdl;
}c[100005];
int n,tot=0;
int ans=0;
int a[100005];
int l[100005],r[100005];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)  scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=1,j=1;i<=n;i=j){
        while(a[i]==a[j])  j++;
        c[++tot].cnt=j-i;
        c[tot].zdl=j-i;
    }
    for(int i=1;i<=tot;i++){
        l[i]=i-1;
        r[i]=i+1;
    }
    for(int i=1;i<=tot;i++){
        for(int j=l[i];;j=l[j]){
            if(j==0)  break;
            if(c[i].zdl<c[j].cnt){
                c[j].cnt-=c[i].zdl;
                break;
            }
            else{
                c[i].zdl-=c[j].cnt;
                c[j].cnt=0;
                l[r[j]]=l[j];
                r[l[j]]=r[j];
            }
        }
    }
    for(int i=1;i<=tot;i++)  ans+=c[i].cnt;
    printf("%d",ans);
    return 0;
}
